package com.lomboardrisk.app.ee_new.xml;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import junit.framework.TestCase;

import com.thoughtworks.xstream.XStream;

public class XstreamTest extends TestCase{

	public void testSerialize() throws Exception {
		XStream xstream = new XStream();
		xstream.alias("nav", Nav.class);
		xstream.alias("header", Header.class);
		xstream.alias("item", Item.class);
		xstream.alias("condition", Condition.class);
//		xstream.setMode(XStream.NO_REFERENCES);
		
		BufferedReader is = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("ee.cfg.xml")));
		
		StringBuffer buffer = new StringBuffer();
		String str;
		while((str = is.readLine()) != null) {
			buffer.append(str);
		}
		
//		String xml = xstream.toXML(joe);
		
//		System.out.println(xml);
		
		Nav newJoe = (Nav)xstream.fromXML(buffer.toString());
		
	}
}
